Left Termination of the query pattern gcd_in_3(g, g, a) w.r.t. the given Prolog program could successfully be proven:



Prolog
  ↳ PrologToPiTRSProof

Clauses:

gcd(X, Y, D) :- ','(le(X, Y), gcd_le(X, Y, D)).
gcd(X, Y, D) :- ','(gt(X, Y), gcd_le(Y, X, D)).
gcd_le(0, Y, Y).
gcd_le(s(X), Y, D) :- ','(add(s(X), Z, Y), gcd(s(X), Z, D)).
gt(s(X), s(Y)) :- gt(X, Y).
gt(s(X), 0).
le(s(X), s(Y)) :- le(X, Y).
le(0, s(Y)).
le(0, 0).
add(s(X), Y, s(Z)) :- add(X, Y, Z).
add(0, X, X).

Queries:

gcd(g,g,a).

We use the technique of [30]. With regard to the inferred argument filtering the predicates were used in the following modes:
gcd_in: (b,b,f)
le_in: (b,b)
gcd_le_in: (b,b,f)
add_in: (b,f,b)
gt_in: (b,b)
Transforming Prolog into the following Term Rewriting System:
Pi-finite rewrite system:
The TRS R consists of the following rules:

gcd_in_gga(X, Y, D) → U1_gga(X, Y, D, le_in_gg(X, Y))
le_in_gg(s(X), s(Y)) → U8_gg(X, Y, le_in_gg(X, Y))
le_in_gg(0, s(Y)) → le_out_gg(0, s(Y))
le_in_gg(0, 0) → le_out_gg(0, 0)
U8_gg(X, Y, le_out_gg(X, Y)) → le_out_gg(s(X), s(Y))
U1_gga(X, Y, D, le_out_gg(X, Y)) → U2_gga(X, Y, D, gcd_le_in_gga(X, Y, D))
gcd_le_in_gga(0, Y, Y) → gcd_le_out_gga(0, Y, Y)
gcd_le_in_gga(s(X), Y, D) → U5_gga(X, Y, D, add_in_gag(s(X), Z, Y))
add_in_gag(s(X), Y, s(Z)) → U9_gag(X, Y, Z, add_in_gag(X, Y, Z))
add_in_gag(0, X, X) → add_out_gag(0, X, X)
U9_gag(X, Y, Z, add_out_gag(X, Y, Z)) → add_out_gag(s(X), Y, s(Z))
U5_gga(X, Y, D, add_out_gag(s(X), Z, Y)) → U6_gga(X, Y, D, gcd_in_gga(s(X), Z, D))
gcd_in_gga(X, Y, D) → U3_gga(X, Y, D, gt_in_gg(X, Y))
gt_in_gg(s(X), s(Y)) → U7_gg(X, Y, gt_in_gg(X, Y))
gt_in_gg(s(X), 0) → gt_out_gg(s(X), 0)
U7_gg(X, Y, gt_out_gg(X, Y)) → gt_out_gg(s(X), s(Y))
U3_gga(X, Y, D, gt_out_gg(X, Y)) → U4_gga(X, Y, D, gcd_le_in_gga(Y, X, D))
U4_gga(X, Y, D, gcd_le_out_gga(Y, X, D)) → gcd_out_gga(X, Y, D)
U6_gga(X, Y, D, gcd_out_gga(s(X), Z, D)) → gcd_le_out_gga(s(X), Y, D)
U2_gga(X, Y, D, gcd_le_out_gga(X, Y, D)) → gcd_out_gga(X, Y, D)

The argument filtering Pi contains the following mapping:
gcd_in_gga(x1, x2, x3)  =  gcd_in_gga(x1, x2)
U1_gga(x1, x2, x3, x4)  =  U1_gga(x1, x2, x4)
le_in_gg(x1, x2)  =  le_in_gg(x1, x2)
s(x1)  =  s(x1)
U8_gg(x1, x2, x3)  =  U8_gg(x3)
0  =  0
le_out_gg(x1, x2)  =  le_out_gg
U2_gga(x1, x2, x3, x4)  =  U2_gga(x4)
gcd_le_in_gga(x1, x2, x3)  =  gcd_le_in_gga(x1, x2)
gcd_le_out_gga(x1, x2, x3)  =  gcd_le_out_gga(x3)
U5_gga(x1, x2, x3, x4)  =  U5_gga(x1, x4)
add_in_gag(x1, x2, x3)  =  add_in_gag(x1, x3)
U9_gag(x1, x2, x3, x4)  =  U9_gag(x4)
add_out_gag(x1, x2, x3)  =  add_out_gag(x2)
U6_gga(x1, x2, x3, x4)  =  U6_gga(x4)
U3_gga(x1, x2, x3, x4)  =  U3_gga(x1, x2, x4)
gt_in_gg(x1, x2)  =  gt_in_gg(x1, x2)
U7_gg(x1, x2, x3)  =  U7_gg(x3)
gt_out_gg(x1, x2)  =  gt_out_gg
U4_gga(x1, x2, x3, x4)  =  U4_gga(x4)
gcd_out_gga(x1, x2, x3)  =  gcd_out_gga(x3)

Infinitary Constructor Rewriting Termination of PiTRS implies Termination of Prolog



↳ Prolog
  ↳ PrologToPiTRSProof
PiTRS
      ↳ DependencyPairsProof

Pi-finite rewrite system:
The TRS R consists of the following rules:

gcd_in_gga(X, Y, D) → U1_gga(X, Y, D, le_in_gg(X, Y))
le_in_gg(s(X), s(Y)) → U8_gg(X, Y, le_in_gg(X, Y))
le_in_gg(0, s(Y)) → le_out_gg(0, s(Y))
le_in_gg(0, 0) → le_out_gg(0, 0)
U8_gg(X, Y, le_out_gg(X, Y)) → le_out_gg(s(X), s(Y))
U1_gga(X, Y, D, le_out_gg(X, Y)) → U2_gga(X, Y, D, gcd_le_in_gga(X, Y, D))
gcd_le_in_gga(0, Y, Y) → gcd_le_out_gga(0, Y, Y)
gcd_le_in_gga(s(X), Y, D) → U5_gga(X, Y, D, add_in_gag(s(X), Z, Y))
add_in_gag(s(X), Y, s(Z)) → U9_gag(X, Y, Z, add_in_gag(X, Y, Z))
add_in_gag(0, X, X) → add_out_gag(0, X, X)
U9_gag(X, Y, Z, add_out_gag(X, Y, Z)) → add_out_gag(s(X), Y, s(Z))
U5_gga(X, Y, D, add_out_gag(s(X), Z, Y)) → U6_gga(X, Y, D, gcd_in_gga(s(X), Z, D))
gcd_in_gga(X, Y, D) → U3_gga(X, Y, D, gt_in_gg(X, Y))
gt_in_gg(s(X), s(Y)) → U7_gg(X, Y, gt_in_gg(X, Y))
gt_in_gg(s(X), 0) → gt_out_gg(s(X), 0)
U7_gg(X, Y, gt_out_gg(X, Y)) → gt_out_gg(s(X), s(Y))
U3_gga(X, Y, D, gt_out_gg(X, Y)) → U4_gga(X, Y, D, gcd_le_in_gga(Y, X, D))
U4_gga(X, Y, D, gcd_le_out_gga(Y, X, D)) → gcd_out_gga(X, Y, D)
U6_gga(X, Y, D, gcd_out_gga(s(X), Z, D)) → gcd_le_out_gga(s(X), Y, D)
U2_gga(X, Y, D, gcd_le_out_gga(X, Y, D)) → gcd_out_gga(X, Y, D)

The argument filtering Pi contains the following mapping:
gcd_in_gga(x1, x2, x3)  =  gcd_in_gga(x1, x2)
U1_gga(x1, x2, x3, x4)  =  U1_gga(x1, x2, x4)
le_in_gg(x1, x2)  =  le_in_gg(x1, x2)
s(x1)  =  s(x1)
U8_gg(x1, x2, x3)  =  U8_gg(x3)
0  =  0
le_out_gg(x1, x2)  =  le_out_gg
U2_gga(x1, x2, x3, x4)  =  U2_gga(x4)
gcd_le_in_gga(x1, x2, x3)  =  gcd_le_in_gga(x1, x2)
gcd_le_out_gga(x1, x2, x3)  =  gcd_le_out_gga(x3)
U5_gga(x1, x2, x3, x4)  =  U5_gga(x1, x4)
add_in_gag(x1, x2, x3)  =  add_in_gag(x1, x3)
U9_gag(x1, x2, x3, x4)  =  U9_gag(x4)
add_out_gag(x1, x2, x3)  =  add_out_gag(x2)
U6_gga(x1, x2, x3, x4)  =  U6_gga(x4)
U3_gga(x1, x2, x3, x4)  =  U3_gga(x1, x2, x4)
gt_in_gg(x1, x2)  =  gt_in_gg(x1, x2)
U7_gg(x1, x2, x3)  =  U7_gg(x3)
gt_out_gg(x1, x2)  =  gt_out_gg
U4_gga(x1, x2, x3, x4)  =  U4_gga(x4)
gcd_out_gga(x1, x2, x3)  =  gcd_out_gga(x3)


Using Dependency Pairs [1,30] we result in the following initial DP problem:
Pi DP problem:
The TRS P consists of the following rules:

GCD_IN_GGA(X, Y, D) → U1_GGA(X, Y, D, le_in_gg(X, Y))
GCD_IN_GGA(X, Y, D) → LE_IN_GG(X, Y)
LE_IN_GG(s(X), s(Y)) → U8_GG(X, Y, le_in_gg(X, Y))
LE_IN_GG(s(X), s(Y)) → LE_IN_GG(X, Y)
U1_GGA(X, Y, D, le_out_gg(X, Y)) → U2_GGA(X, Y, D, gcd_le_in_gga(X, Y, D))
U1_GGA(X, Y, D, le_out_gg(X, Y)) → GCD_LE_IN_GGA(X, Y, D)
GCD_LE_IN_GGA(s(X), Y, D) → U5_GGA(X, Y, D, add_in_gag(s(X), Z, Y))
GCD_LE_IN_GGA(s(X), Y, D) → ADD_IN_GAG(s(X), Z, Y)
ADD_IN_GAG(s(X), Y, s(Z)) → U9_GAG(X, Y, Z, add_in_gag(X, Y, Z))
ADD_IN_GAG(s(X), Y, s(Z)) → ADD_IN_GAG(X, Y, Z)
U5_GGA(X, Y, D, add_out_gag(s(X), Z, Y)) → U6_GGA(X, Y, D, gcd_in_gga(s(X), Z, D))
U5_GGA(X, Y, D, add_out_gag(s(X), Z, Y)) → GCD_IN_GGA(s(X), Z, D)
GCD_IN_GGA(X, Y, D) → U3_GGA(X, Y, D, gt_in_gg(X, Y))
GCD_IN_GGA(X, Y, D) → GT_IN_GG(X, Y)
GT_IN_GG(s(X), s(Y)) → U7_GG(X, Y, gt_in_gg(X, Y))
GT_IN_GG(s(X), s(Y)) → GT_IN_GG(X, Y)
U3_GGA(X, Y, D, gt_out_gg(X, Y)) → U4_GGA(X, Y, D, gcd_le_in_gga(Y, X, D))
U3_GGA(X, Y, D, gt_out_gg(X, Y)) → GCD_LE_IN_GGA(Y, X, D)

The TRS R consists of the following rules:

gcd_in_gga(X, Y, D) → U1_gga(X, Y, D, le_in_gg(X, Y))
le_in_gg(s(X), s(Y)) → U8_gg(X, Y, le_in_gg(X, Y))
le_in_gg(0, s(Y)) → le_out_gg(0, s(Y))
le_in_gg(0, 0) → le_out_gg(0, 0)
U8_gg(X, Y, le_out_gg(X, Y)) → le_out_gg(s(X), s(Y))
U1_gga(X, Y, D, le_out_gg(X, Y)) → U2_gga(X, Y, D, gcd_le_in_gga(X, Y, D))
gcd_le_in_gga(0, Y, Y) → gcd_le_out_gga(0, Y, Y)
gcd_le_in_gga(s(X), Y, D) → U5_gga(X, Y, D, add_in_gag(s(X), Z, Y))
add_in_gag(s(X), Y, s(Z)) → U9_gag(X, Y, Z, add_in_gag(X, Y, Z))
add_in_gag(0, X, X) → add_out_gag(0, X, X)
U9_gag(X, Y, Z, add_out_gag(X, Y, Z)) → add_out_gag(s(X), Y, s(Z))
U5_gga(X, Y, D, add_out_gag(s(X), Z, Y)) → U6_gga(X, Y, D, gcd_in_gga(s(X), Z, D))
gcd_in_gga(X, Y, D) → U3_gga(X, Y, D, gt_in_gg(X, Y))
gt_in_gg(s(X), s(Y)) → U7_gg(X, Y, gt_in_gg(X, Y))
gt_in_gg(s(X), 0) → gt_out_gg(s(X), 0)
U7_gg(X, Y, gt_out_gg(X, Y)) → gt_out_gg(s(X), s(Y))
U3_gga(X, Y, D, gt_out_gg(X, Y)) → U4_gga(X, Y, D, gcd_le_in_gga(Y, X, D))
U4_gga(X, Y, D, gcd_le_out_gga(Y, X, D)) → gcd_out_gga(X, Y, D)
U6_gga(X, Y, D, gcd_out_gga(s(X), Z, D)) → gcd_le_out_gga(s(X), Y, D)
U2_gga(X, Y, D, gcd_le_out_gga(X, Y, D)) → gcd_out_gga(X, Y, D)

The argument filtering Pi contains the following mapping:
gcd_in_gga(x1, x2, x3)  =  gcd_in_gga(x1, x2)
U1_gga(x1, x2, x3, x4)  =  U1_gga(x1, x2, x4)
le_in_gg(x1, x2)  =  le_in_gg(x1, x2)
s(x1)  =  s(x1)
U8_gg(x1, x2, x3)  =  U8_gg(x3)
0  =  0
le_out_gg(x1, x2)  =  le_out_gg
U2_gga(x1, x2, x3, x4)  =  U2_gga(x4)
gcd_le_in_gga(x1, x2, x3)  =  gcd_le_in_gga(x1, x2)
gcd_le_out_gga(x1, x2, x3)  =  gcd_le_out_gga(x3)
U5_gga(x1, x2, x3, x4)  =  U5_gga(x1, x4)
add_in_gag(x1, x2, x3)  =  add_in_gag(x1, x3)
U9_gag(x1, x2, x3, x4)  =  U9_gag(x4)
add_out_gag(x1, x2, x3)  =  add_out_gag(x2)
U6_gga(x1, x2, x3, x4)  =  U6_gga(x4)
U3_gga(x1, x2, x3, x4)  =  U3_gga(x1, x2, x4)
gt_in_gg(x1, x2)  =  gt_in_gg(x1, x2)
U7_gg(x1, x2, x3)  =  U7_gg(x3)
gt_out_gg(x1, x2)  =  gt_out_gg
U4_gga(x1, x2, x3, x4)  =  U4_gga(x4)
gcd_out_gga(x1, x2, x3)  =  gcd_out_gga(x3)
GCD_IN_GGA(x1, x2, x3)  =  GCD_IN_GGA(x1, x2)
U6_GGA(x1, x2, x3, x4)  =  U6_GGA(x4)
LE_IN_GG(x1, x2)  =  LE_IN_GG(x1, x2)
U4_GGA(x1, x2, x3, x4)  =  U4_GGA(x4)
GCD_LE_IN_GGA(x1, x2, x3)  =  GCD_LE_IN_GGA(x1, x2)
U2_GGA(x1, x2, x3, x4)  =  U2_GGA(x4)
U5_GGA(x1, x2, x3, x4)  =  U5_GGA(x1, x4)
U1_GGA(x1, x2, x3, x4)  =  U1_GGA(x1, x2, x4)
GT_IN_GG(x1, x2)  =  GT_IN_GG(x1, x2)
ADD_IN_GAG(x1, x2, x3)  =  ADD_IN_GAG(x1, x3)
U3_GGA(x1, x2, x3, x4)  =  U3_GGA(x1, x2, x4)
U8_GG(x1, x2, x3)  =  U8_GG(x3)
U7_GG(x1, x2, x3)  =  U7_GG(x3)
U9_GAG(x1, x2, x3, x4)  =  U9_GAG(x4)

We have to consider all (P,R,Pi)-chains

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
PiDP
          ↳ DependencyGraphProof

Pi DP problem:
The TRS P consists of the following rules:

GCD_IN_GGA(X, Y, D) → U1_GGA(X, Y, D, le_in_gg(X, Y))
GCD_IN_GGA(X, Y, D) → LE_IN_GG(X, Y)
LE_IN_GG(s(X), s(Y)) → U8_GG(X, Y, le_in_gg(X, Y))
LE_IN_GG(s(X), s(Y)) → LE_IN_GG(X, Y)
U1_GGA(X, Y, D, le_out_gg(X, Y)) → U2_GGA(X, Y, D, gcd_le_in_gga(X, Y, D))
U1_GGA(X, Y, D, le_out_gg(X, Y)) → GCD_LE_IN_GGA(X, Y, D)
GCD_LE_IN_GGA(s(X), Y, D) → U5_GGA(X, Y, D, add_in_gag(s(X), Z, Y))
GCD_LE_IN_GGA(s(X), Y, D) → ADD_IN_GAG(s(X), Z, Y)
ADD_IN_GAG(s(X), Y, s(Z)) → U9_GAG(X, Y, Z, add_in_gag(X, Y, Z))
ADD_IN_GAG(s(X), Y, s(Z)) → ADD_IN_GAG(X, Y, Z)
U5_GGA(X, Y, D, add_out_gag(s(X), Z, Y)) → U6_GGA(X, Y, D, gcd_in_gga(s(X), Z, D))
U5_GGA(X, Y, D, add_out_gag(s(X), Z, Y)) → GCD_IN_GGA(s(X), Z, D)
GCD_IN_GGA(X, Y, D) → U3_GGA(X, Y, D, gt_in_gg(X, Y))
GCD_IN_GGA(X, Y, D) → GT_IN_GG(X, Y)
GT_IN_GG(s(X), s(Y)) → U7_GG(X, Y, gt_in_gg(X, Y))
GT_IN_GG(s(X), s(Y)) → GT_IN_GG(X, Y)
U3_GGA(X, Y, D, gt_out_gg(X, Y)) → U4_GGA(X, Y, D, gcd_le_in_gga(Y, X, D))
U3_GGA(X, Y, D, gt_out_gg(X, Y)) → GCD_LE_IN_GGA(Y, X, D)

The TRS R consists of the following rules:

gcd_in_gga(X, Y, D) → U1_gga(X, Y, D, le_in_gg(X, Y))
le_in_gg(s(X), s(Y)) → U8_gg(X, Y, le_in_gg(X, Y))
le_in_gg(0, s(Y)) → le_out_gg(0, s(Y))
le_in_gg(0, 0) → le_out_gg(0, 0)
U8_gg(X, Y, le_out_gg(X, Y)) → le_out_gg(s(X), s(Y))
U1_gga(X, Y, D, le_out_gg(X, Y)) → U2_gga(X, Y, D, gcd_le_in_gga(X, Y, D))
gcd_le_in_gga(0, Y, Y) → gcd_le_out_gga(0, Y, Y)
gcd_le_in_gga(s(X), Y, D) → U5_gga(X, Y, D, add_in_gag(s(X), Z, Y))
add_in_gag(s(X), Y, s(Z)) → U9_gag(X, Y, Z, add_in_gag(X, Y, Z))
add_in_gag(0, X, X) → add_out_gag(0, X, X)
U9_gag(X, Y, Z, add_out_gag(X, Y, Z)) → add_out_gag(s(X), Y, s(Z))
U5_gga(X, Y, D, add_out_gag(s(X), Z, Y)) → U6_gga(X, Y, D, gcd_in_gga(s(X), Z, D))
gcd_in_gga(X, Y, D) → U3_gga(X, Y, D, gt_in_gg(X, Y))
gt_in_gg(s(X), s(Y)) → U7_gg(X, Y, gt_in_gg(X, Y))
gt_in_gg(s(X), 0) → gt_out_gg(s(X), 0)
U7_gg(X, Y, gt_out_gg(X, Y)) → gt_out_gg(s(X), s(Y))
U3_gga(X, Y, D, gt_out_gg(X, Y)) → U4_gga(X, Y, D, gcd_le_in_gga(Y, X, D))
U4_gga(X, Y, D, gcd_le_out_gga(Y, X, D)) → gcd_out_gga(X, Y, D)
U6_gga(X, Y, D, gcd_out_gga(s(X), Z, D)) → gcd_le_out_gga(s(X), Y, D)
U2_gga(X, Y, D, gcd_le_out_gga(X, Y, D)) → gcd_out_gga(X, Y, D)

The argument filtering Pi contains the following mapping:
gcd_in_gga(x1, x2, x3)  =  gcd_in_gga(x1, x2)
U1_gga(x1, x2, x3, x4)  =  U1_gga(x1, x2, x4)
le_in_gg(x1, x2)  =  le_in_gg(x1, x2)
s(x1)  =  s(x1)
U8_gg(x1, x2, x3)  =  U8_gg(x3)
0  =  0
le_out_gg(x1, x2)  =  le_out_gg
U2_gga(x1, x2, x3, x4)  =  U2_gga(x4)
gcd_le_in_gga(x1, x2, x3)  =  gcd_le_in_gga(x1, x2)
gcd_le_out_gga(x1, x2, x3)  =  gcd_le_out_gga(x3)
U5_gga(x1, x2, x3, x4)  =  U5_gga(x1, x4)
add_in_gag(x1, x2, x3)  =  add_in_gag(x1, x3)
U9_gag(x1, x2, x3, x4)  =  U9_gag(x4)
add_out_gag(x1, x2, x3)  =  add_out_gag(x2)
U6_gga(x1, x2, x3, x4)  =  U6_gga(x4)
U3_gga(x1, x2, x3, x4)  =  U3_gga(x1, x2, x4)
gt_in_gg(x1, x2)  =  gt_in_gg(x1, x2)
U7_gg(x1, x2, x3)  =  U7_gg(x3)
gt_out_gg(x1, x2)  =  gt_out_gg
U4_gga(x1, x2, x3, x4)  =  U4_gga(x4)
gcd_out_gga(x1, x2, x3)  =  gcd_out_gga(x3)
GCD_IN_GGA(x1, x2, x3)  =  GCD_IN_GGA(x1, x2)
U6_GGA(x1, x2, x3, x4)  =  U6_GGA(x4)
LE_IN_GG(x1, x2)  =  LE_IN_GG(x1, x2)
U4_GGA(x1, x2, x3, x4)  =  U4_GGA(x4)
GCD_LE_IN_GGA(x1, x2, x3)  =  GCD_LE_IN_GGA(x1, x2)
U2_GGA(x1, x2, x3, x4)  =  U2_GGA(x4)
U5_GGA(x1, x2, x3, x4)  =  U5_GGA(x1, x4)
U1_GGA(x1, x2, x3, x4)  =  U1_GGA(x1, x2, x4)
GT_IN_GG(x1, x2)  =  GT_IN_GG(x1, x2)
ADD_IN_GAG(x1, x2, x3)  =  ADD_IN_GAG(x1, x3)
U3_GGA(x1, x2, x3, x4)  =  U3_GGA(x1, x2, x4)
U8_GG(x1, x2, x3)  =  U8_GG(x3)
U7_GG(x1, x2, x3)  =  U7_GG(x3)
U9_GAG(x1, x2, x3, x4)  =  U9_GAG(x4)

We have to consider all (P,R,Pi)-chains
The approximation of the Dependency Graph [30] contains 4 SCCs with 9 less nodes.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
PiDP
                ↳ UsableRulesProof
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

GT_IN_GG(s(X), s(Y)) → GT_IN_GG(X, Y)

The TRS R consists of the following rules:

gcd_in_gga(X, Y, D) → U1_gga(X, Y, D, le_in_gg(X, Y))
le_in_gg(s(X), s(Y)) → U8_gg(X, Y, le_in_gg(X, Y))
le_in_gg(0, s(Y)) → le_out_gg(0, s(Y))
le_in_gg(0, 0) → le_out_gg(0, 0)
U8_gg(X, Y, le_out_gg(X, Y)) → le_out_gg(s(X), s(Y))
U1_gga(X, Y, D, le_out_gg(X, Y)) → U2_gga(X, Y, D, gcd_le_in_gga(X, Y, D))
gcd_le_in_gga(0, Y, Y) → gcd_le_out_gga(0, Y, Y)
gcd_le_in_gga(s(X), Y, D) → U5_gga(X, Y, D, add_in_gag(s(X), Z, Y))
add_in_gag(s(X), Y, s(Z)) → U9_gag(X, Y, Z, add_in_gag(X, Y, Z))
add_in_gag(0, X, X) → add_out_gag(0, X, X)
U9_gag(X, Y, Z, add_out_gag(X, Y, Z)) → add_out_gag(s(X), Y, s(Z))
U5_gga(X, Y, D, add_out_gag(s(X), Z, Y)) → U6_gga(X, Y, D, gcd_in_gga(s(X), Z, D))
gcd_in_gga(X, Y, D) → U3_gga(X, Y, D, gt_in_gg(X, Y))
gt_in_gg(s(X), s(Y)) → U7_gg(X, Y, gt_in_gg(X, Y))
gt_in_gg(s(X), 0) → gt_out_gg(s(X), 0)
U7_gg(X, Y, gt_out_gg(X, Y)) → gt_out_gg(s(X), s(Y))
U3_gga(X, Y, D, gt_out_gg(X, Y)) → U4_gga(X, Y, D, gcd_le_in_gga(Y, X, D))
U4_gga(X, Y, D, gcd_le_out_gga(Y, X, D)) → gcd_out_gga(X, Y, D)
U6_gga(X, Y, D, gcd_out_gga(s(X), Z, D)) → gcd_le_out_gga(s(X), Y, D)
U2_gga(X, Y, D, gcd_le_out_gga(X, Y, D)) → gcd_out_gga(X, Y, D)

The argument filtering Pi contains the following mapping:
gcd_in_gga(x1, x2, x3)  =  gcd_in_gga(x1, x2)
U1_gga(x1, x2, x3, x4)  =  U1_gga(x1, x2, x4)
le_in_gg(x1, x2)  =  le_in_gg(x1, x2)
s(x1)  =  s(x1)
U8_gg(x1, x2, x3)  =  U8_gg(x3)
0  =  0
le_out_gg(x1, x2)  =  le_out_gg
U2_gga(x1, x2, x3, x4)  =  U2_gga(x4)
gcd_le_in_gga(x1, x2, x3)  =  gcd_le_in_gga(x1, x2)
gcd_le_out_gga(x1, x2, x3)  =  gcd_le_out_gga(x3)
U5_gga(x1, x2, x3, x4)  =  U5_gga(x1, x4)
add_in_gag(x1, x2, x3)  =  add_in_gag(x1, x3)
U9_gag(x1, x2, x3, x4)  =  U9_gag(x4)
add_out_gag(x1, x2, x3)  =  add_out_gag(x2)
U6_gga(x1, x2, x3, x4)  =  U6_gga(x4)
U3_gga(x1, x2, x3, x4)  =  U3_gga(x1, x2, x4)
gt_in_gg(x1, x2)  =  gt_in_gg(x1, x2)
U7_gg(x1, x2, x3)  =  U7_gg(x3)
gt_out_gg(x1, x2)  =  gt_out_gg
U4_gga(x1, x2, x3, x4)  =  U4_gga(x4)
gcd_out_gga(x1, x2, x3)  =  gcd_out_gga(x3)
GT_IN_GG(x1, x2)  =  GT_IN_GG(x1, x2)

We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting [30] we can delete all non-usable rules from R.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
                ↳ UsableRulesProof
PiDP
                    ↳ PiDPToQDPProof
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

GT_IN_GG(s(X), s(Y)) → GT_IN_GG(X, Y)

R is empty.
Pi is empty.
We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
QDP
                        ↳ QDPSizeChangeProof
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP

Q DP problem:
The TRS P consists of the following rules:

GT_IN_GG(s(X), s(Y)) → GT_IN_GG(X, Y)

R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.
By using the subterm criterion [20] together with the size-change analysis [32] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs:



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
PiDP
                ↳ UsableRulesProof
              ↳ PiDP
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

ADD_IN_GAG(s(X), Y, s(Z)) → ADD_IN_GAG(X, Y, Z)

The TRS R consists of the following rules:

gcd_in_gga(X, Y, D) → U1_gga(X, Y, D, le_in_gg(X, Y))
le_in_gg(s(X), s(Y)) → U8_gg(X, Y, le_in_gg(X, Y))
le_in_gg(0, s(Y)) → le_out_gg(0, s(Y))
le_in_gg(0, 0) → le_out_gg(0, 0)
U8_gg(X, Y, le_out_gg(X, Y)) → le_out_gg(s(X), s(Y))
U1_gga(X, Y, D, le_out_gg(X, Y)) → U2_gga(X, Y, D, gcd_le_in_gga(X, Y, D))
gcd_le_in_gga(0, Y, Y) → gcd_le_out_gga(0, Y, Y)
gcd_le_in_gga(s(X), Y, D) → U5_gga(X, Y, D, add_in_gag(s(X), Z, Y))
add_in_gag(s(X), Y, s(Z)) → U9_gag(X, Y, Z, add_in_gag(X, Y, Z))
add_in_gag(0, X, X) → add_out_gag(0, X, X)
U9_gag(X, Y, Z, add_out_gag(X, Y, Z)) → add_out_gag(s(X), Y, s(Z))
U5_gga(X, Y, D, add_out_gag(s(X), Z, Y)) → U6_gga(X, Y, D, gcd_in_gga(s(X), Z, D))
gcd_in_gga(X, Y, D) → U3_gga(X, Y, D, gt_in_gg(X, Y))
gt_in_gg(s(X), s(Y)) → U7_gg(X, Y, gt_in_gg(X, Y))
gt_in_gg(s(X), 0) → gt_out_gg(s(X), 0)
U7_gg(X, Y, gt_out_gg(X, Y)) → gt_out_gg(s(X), s(Y))
U3_gga(X, Y, D, gt_out_gg(X, Y)) → U4_gga(X, Y, D, gcd_le_in_gga(Y, X, D))
U4_gga(X, Y, D, gcd_le_out_gga(Y, X, D)) → gcd_out_gga(X, Y, D)
U6_gga(X, Y, D, gcd_out_gga(s(X), Z, D)) → gcd_le_out_gga(s(X), Y, D)
U2_gga(X, Y, D, gcd_le_out_gga(X, Y, D)) → gcd_out_gga(X, Y, D)

The argument filtering Pi contains the following mapping:
gcd_in_gga(x1, x2, x3)  =  gcd_in_gga(x1, x2)
U1_gga(x1, x2, x3, x4)  =  U1_gga(x1, x2, x4)
le_in_gg(x1, x2)  =  le_in_gg(x1, x2)
s(x1)  =  s(x1)
U8_gg(x1, x2, x3)  =  U8_gg(x3)
0  =  0
le_out_gg(x1, x2)  =  le_out_gg
U2_gga(x1, x2, x3, x4)  =  U2_gga(x4)
gcd_le_in_gga(x1, x2, x3)  =  gcd_le_in_gga(x1, x2)
gcd_le_out_gga(x1, x2, x3)  =  gcd_le_out_gga(x3)
U5_gga(x1, x2, x3, x4)  =  U5_gga(x1, x4)
add_in_gag(x1, x2, x3)  =  add_in_gag(x1, x3)
U9_gag(x1, x2, x3, x4)  =  U9_gag(x4)
add_out_gag(x1, x2, x3)  =  add_out_gag(x2)
U6_gga(x1, x2, x3, x4)  =  U6_gga(x4)
U3_gga(x1, x2, x3, x4)  =  U3_gga(x1, x2, x4)
gt_in_gg(x1, x2)  =  gt_in_gg(x1, x2)
U7_gg(x1, x2, x3)  =  U7_gg(x3)
gt_out_gg(x1, x2)  =  gt_out_gg
U4_gga(x1, x2, x3, x4)  =  U4_gga(x4)
gcd_out_gga(x1, x2, x3)  =  gcd_out_gga(x3)
ADD_IN_GAG(x1, x2, x3)  =  ADD_IN_GAG(x1, x3)

We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting [30] we can delete all non-usable rules from R.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
PiDP
                    ↳ PiDPToQDPProof
              ↳ PiDP
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

ADD_IN_GAG(s(X), Y, s(Z)) → ADD_IN_GAG(X, Y, Z)

R is empty.
The argument filtering Pi contains the following mapping:
s(x1)  =  s(x1)
ADD_IN_GAG(x1, x2, x3)  =  ADD_IN_GAG(x1, x3)

We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
QDP
                        ↳ QDPSizeChangeProof
              ↳ PiDP
              ↳ PiDP

Q DP problem:
The TRS P consists of the following rules:

ADD_IN_GAG(s(X), s(Z)) → ADD_IN_GAG(X, Z)

R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.
By using the subterm criterion [20] together with the size-change analysis [32] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs:



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
PiDP
                ↳ UsableRulesProof
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

LE_IN_GG(s(X), s(Y)) → LE_IN_GG(X, Y)

The TRS R consists of the following rules:

gcd_in_gga(X, Y, D) → U1_gga(X, Y, D, le_in_gg(X, Y))
le_in_gg(s(X), s(Y)) → U8_gg(X, Y, le_in_gg(X, Y))
le_in_gg(0, s(Y)) → le_out_gg(0, s(Y))
le_in_gg(0, 0) → le_out_gg(0, 0)
U8_gg(X, Y, le_out_gg(X, Y)) → le_out_gg(s(X), s(Y))
U1_gga(X, Y, D, le_out_gg(X, Y)) → U2_gga(X, Y, D, gcd_le_in_gga(X, Y, D))
gcd_le_in_gga(0, Y, Y) → gcd_le_out_gga(0, Y, Y)
gcd_le_in_gga(s(X), Y, D) → U5_gga(X, Y, D, add_in_gag(s(X), Z, Y))
add_in_gag(s(X), Y, s(Z)) → U9_gag(X, Y, Z, add_in_gag(X, Y, Z))
add_in_gag(0, X, X) → add_out_gag(0, X, X)
U9_gag(X, Y, Z, add_out_gag(X, Y, Z)) → add_out_gag(s(X), Y, s(Z))
U5_gga(X, Y, D, add_out_gag(s(X), Z, Y)) → U6_gga(X, Y, D, gcd_in_gga(s(X), Z, D))
gcd_in_gga(X, Y, D) → U3_gga(X, Y, D, gt_in_gg(X, Y))
gt_in_gg(s(X), s(Y)) → U7_gg(X, Y, gt_in_gg(X, Y))
gt_in_gg(s(X), 0) → gt_out_gg(s(X), 0)
U7_gg(X, Y, gt_out_gg(X, Y)) → gt_out_gg(s(X), s(Y))
U3_gga(X, Y, D, gt_out_gg(X, Y)) → U4_gga(X, Y, D, gcd_le_in_gga(Y, X, D))
U4_gga(X, Y, D, gcd_le_out_gga(Y, X, D)) → gcd_out_gga(X, Y, D)
U6_gga(X, Y, D, gcd_out_gga(s(X), Z, D)) → gcd_le_out_gga(s(X), Y, D)
U2_gga(X, Y, D, gcd_le_out_gga(X, Y, D)) → gcd_out_gga(X, Y, D)

The argument filtering Pi contains the following mapping:
gcd_in_gga(x1, x2, x3)  =  gcd_in_gga(x1, x2)
U1_gga(x1, x2, x3, x4)  =  U1_gga(x1, x2, x4)
le_in_gg(x1, x2)  =  le_in_gg(x1, x2)
s(x1)  =  s(x1)
U8_gg(x1, x2, x3)  =  U8_gg(x3)
0  =  0
le_out_gg(x1, x2)  =  le_out_gg
U2_gga(x1, x2, x3, x4)  =  U2_gga(x4)
gcd_le_in_gga(x1, x2, x3)  =  gcd_le_in_gga(x1, x2)
gcd_le_out_gga(x1, x2, x3)  =  gcd_le_out_gga(x3)
U5_gga(x1, x2, x3, x4)  =  U5_gga(x1, x4)
add_in_gag(x1, x2, x3)  =  add_in_gag(x1, x3)
U9_gag(x1, x2, x3, x4)  =  U9_gag(x4)
add_out_gag(x1, x2, x3)  =  add_out_gag(x2)
U6_gga(x1, x2, x3, x4)  =  U6_gga(x4)
U3_gga(x1, x2, x3, x4)  =  U3_gga(x1, x2, x4)
gt_in_gg(x1, x2)  =  gt_in_gg(x1, x2)
U7_gg(x1, x2, x3)  =  U7_gg(x3)
gt_out_gg(x1, x2)  =  gt_out_gg
U4_gga(x1, x2, x3, x4)  =  U4_gga(x4)
gcd_out_gga(x1, x2, x3)  =  gcd_out_gga(x3)
LE_IN_GG(x1, x2)  =  LE_IN_GG(x1, x2)

We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting [30] we can delete all non-usable rules from R.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
PiDP
                    ↳ PiDPToQDPProof
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

LE_IN_GG(s(X), s(Y)) → LE_IN_GG(X, Y)

R is empty.
Pi is empty.
We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
QDP
                        ↳ QDPSizeChangeProof
              ↳ PiDP

Q DP problem:
The TRS P consists of the following rules:

LE_IN_GG(s(X), s(Y)) → LE_IN_GG(X, Y)

R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.
By using the subterm criterion [20] together with the size-change analysis [32] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs:



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
PiDP
                ↳ UsableRulesProof

Pi DP problem:
The TRS P consists of the following rules:

GCD_LE_IN_GGA(s(X), Y, D) → U5_GGA(X, Y, D, add_in_gag(s(X), Z, Y))
U1_GGA(X, Y, D, le_out_gg(X, Y)) → GCD_LE_IN_GGA(X, Y, D)
U3_GGA(X, Y, D, gt_out_gg(X, Y)) → GCD_LE_IN_GGA(Y, X, D)
GCD_IN_GGA(X, Y, D) → U3_GGA(X, Y, D, gt_in_gg(X, Y))
GCD_IN_GGA(X, Y, D) → U1_GGA(X, Y, D, le_in_gg(X, Y))
U5_GGA(X, Y, D, add_out_gag(s(X), Z, Y)) → GCD_IN_GGA(s(X), Z, D)

The TRS R consists of the following rules:

gcd_in_gga(X, Y, D) → U1_gga(X, Y, D, le_in_gg(X, Y))
le_in_gg(s(X), s(Y)) → U8_gg(X, Y, le_in_gg(X, Y))
le_in_gg(0, s(Y)) → le_out_gg(0, s(Y))
le_in_gg(0, 0) → le_out_gg(0, 0)
U8_gg(X, Y, le_out_gg(X, Y)) → le_out_gg(s(X), s(Y))
U1_gga(X, Y, D, le_out_gg(X, Y)) → U2_gga(X, Y, D, gcd_le_in_gga(X, Y, D))
gcd_le_in_gga(0, Y, Y) → gcd_le_out_gga(0, Y, Y)
gcd_le_in_gga(s(X), Y, D) → U5_gga(X, Y, D, add_in_gag(s(X), Z, Y))
add_in_gag(s(X), Y, s(Z)) → U9_gag(X, Y, Z, add_in_gag(X, Y, Z))
add_in_gag(0, X, X) → add_out_gag(0, X, X)
U9_gag(X, Y, Z, add_out_gag(X, Y, Z)) → add_out_gag(s(X), Y, s(Z))
U5_gga(X, Y, D, add_out_gag(s(X), Z, Y)) → U6_gga(X, Y, D, gcd_in_gga(s(X), Z, D))
gcd_in_gga(X, Y, D) → U3_gga(X, Y, D, gt_in_gg(X, Y))
gt_in_gg(s(X), s(Y)) → U7_gg(X, Y, gt_in_gg(X, Y))
gt_in_gg(s(X), 0) → gt_out_gg(s(X), 0)
U7_gg(X, Y, gt_out_gg(X, Y)) → gt_out_gg(s(X), s(Y))
U3_gga(X, Y, D, gt_out_gg(X, Y)) → U4_gga(X, Y, D, gcd_le_in_gga(Y, X, D))
U4_gga(X, Y, D, gcd_le_out_gga(Y, X, D)) → gcd_out_gga(X, Y, D)
U6_gga(X, Y, D, gcd_out_gga(s(X), Z, D)) → gcd_le_out_gga(s(X), Y, D)
U2_gga(X, Y, D, gcd_le_out_gga(X, Y, D)) → gcd_out_gga(X, Y, D)

The argument filtering Pi contains the following mapping:
gcd_in_gga(x1, x2, x3)  =  gcd_in_gga(x1, x2)
U1_gga(x1, x2, x3, x4)  =  U1_gga(x1, x2, x4)
le_in_gg(x1, x2)  =  le_in_gg(x1, x2)
s(x1)  =  s(x1)
U8_gg(x1, x2, x3)  =  U8_gg(x3)
0  =  0
le_out_gg(x1, x2)  =  le_out_gg
U2_gga(x1, x2, x3, x4)  =  U2_gga(x4)
gcd_le_in_gga(x1, x2, x3)  =  gcd_le_in_gga(x1, x2)
gcd_le_out_gga(x1, x2, x3)  =  gcd_le_out_gga(x3)
U5_gga(x1, x2, x3, x4)  =  U5_gga(x1, x4)
add_in_gag(x1, x2, x3)  =  add_in_gag(x1, x3)
U9_gag(x1, x2, x3, x4)  =  U9_gag(x4)
add_out_gag(x1, x2, x3)  =  add_out_gag(x2)
U6_gga(x1, x2, x3, x4)  =  U6_gga(x4)
U3_gga(x1, x2, x3, x4)  =  U3_gga(x1, x2, x4)
gt_in_gg(x1, x2)  =  gt_in_gg(x1, x2)
U7_gg(x1, x2, x3)  =  U7_gg(x3)
gt_out_gg(x1, x2)  =  gt_out_gg
U4_gga(x1, x2, x3, x4)  =  U4_gga(x4)
gcd_out_gga(x1, x2, x3)  =  gcd_out_gga(x3)
GCD_IN_GGA(x1, x2, x3)  =  GCD_IN_GGA(x1, x2)
GCD_LE_IN_GGA(x1, x2, x3)  =  GCD_LE_IN_GGA(x1, x2)
U5_GGA(x1, x2, x3, x4)  =  U5_GGA(x1, x4)
U1_GGA(x1, x2, x3, x4)  =  U1_GGA(x1, x2, x4)
U3_GGA(x1, x2, x3, x4)  =  U3_GGA(x1, x2, x4)

We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting [30] we can delete all non-usable rules from R.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
PiDP
                    ↳ PiDPToQDPProof

Pi DP problem:
The TRS P consists of the following rules:

GCD_LE_IN_GGA(s(X), Y, D) → U5_GGA(X, Y, D, add_in_gag(s(X), Z, Y))
U1_GGA(X, Y, D, le_out_gg(X, Y)) → GCD_LE_IN_GGA(X, Y, D)
U3_GGA(X, Y, D, gt_out_gg(X, Y)) → GCD_LE_IN_GGA(Y, X, D)
GCD_IN_GGA(X, Y, D) → U3_GGA(X, Y, D, gt_in_gg(X, Y))
GCD_IN_GGA(X, Y, D) → U1_GGA(X, Y, D, le_in_gg(X, Y))
U5_GGA(X, Y, D, add_out_gag(s(X), Z, Y)) → GCD_IN_GGA(s(X), Z, D)

The TRS R consists of the following rules:

add_in_gag(s(X), Y, s(Z)) → U9_gag(X, Y, Z, add_in_gag(X, Y, Z))
gt_in_gg(s(X), s(Y)) → U7_gg(X, Y, gt_in_gg(X, Y))
gt_in_gg(s(X), 0) → gt_out_gg(s(X), 0)
le_in_gg(s(X), s(Y)) → U8_gg(X, Y, le_in_gg(X, Y))
le_in_gg(0, s(Y)) → le_out_gg(0, s(Y))
le_in_gg(0, 0) → le_out_gg(0, 0)
U9_gag(X, Y, Z, add_out_gag(X, Y, Z)) → add_out_gag(s(X), Y, s(Z))
U7_gg(X, Y, gt_out_gg(X, Y)) → gt_out_gg(s(X), s(Y))
U8_gg(X, Y, le_out_gg(X, Y)) → le_out_gg(s(X), s(Y))
add_in_gag(0, X, X) → add_out_gag(0, X, X)

The argument filtering Pi contains the following mapping:
le_in_gg(x1, x2)  =  le_in_gg(x1, x2)
s(x1)  =  s(x1)
U8_gg(x1, x2, x3)  =  U8_gg(x3)
0  =  0
le_out_gg(x1, x2)  =  le_out_gg
add_in_gag(x1, x2, x3)  =  add_in_gag(x1, x3)
U9_gag(x1, x2, x3, x4)  =  U9_gag(x4)
add_out_gag(x1, x2, x3)  =  add_out_gag(x2)
gt_in_gg(x1, x2)  =  gt_in_gg(x1, x2)
U7_gg(x1, x2, x3)  =  U7_gg(x3)
gt_out_gg(x1, x2)  =  gt_out_gg
GCD_IN_GGA(x1, x2, x3)  =  GCD_IN_GGA(x1, x2)
GCD_LE_IN_GGA(x1, x2, x3)  =  GCD_LE_IN_GGA(x1, x2)
U5_GGA(x1, x2, x3, x4)  =  U5_GGA(x1, x4)
U1_GGA(x1, x2, x3, x4)  =  U1_GGA(x1, x2, x4)
U3_GGA(x1, x2, x3, x4)  =  U3_GGA(x1, x2, x4)

We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
QDP
                        ↳ QDPOrderProof

Q DP problem:
The TRS P consists of the following rules:

U1_GGA(X, Y, le_out_gg) → GCD_LE_IN_GGA(X, Y)
U5_GGA(X, add_out_gag(Z)) → GCD_IN_GGA(s(X), Z)
GCD_LE_IN_GGA(s(X), Y) → U5_GGA(X, add_in_gag(s(X), Y))
GCD_IN_GGA(X, Y) → U1_GGA(X, Y, le_in_gg(X, Y))
GCD_IN_GGA(X, Y) → U3_GGA(X, Y, gt_in_gg(X, Y))
U3_GGA(X, Y, gt_out_gg) → GCD_LE_IN_GGA(Y, X)

The TRS R consists of the following rules:

add_in_gag(s(X), s(Z)) → U9_gag(add_in_gag(X, Z))
gt_in_gg(s(X), s(Y)) → U7_gg(gt_in_gg(X, Y))
gt_in_gg(s(X), 0) → gt_out_gg
le_in_gg(s(X), s(Y)) → U8_gg(le_in_gg(X, Y))
le_in_gg(0, s(Y)) → le_out_gg
le_in_gg(0, 0) → le_out_gg
U9_gag(add_out_gag(Y)) → add_out_gag(Y)
U7_gg(gt_out_gg) → gt_out_gg
U8_gg(le_out_gg) → le_out_gg
add_in_gag(0, X) → add_out_gag(X)

The set Q consists of the following terms:

add_in_gag(x0, x1)
gt_in_gg(x0, x1)
le_in_gg(x0, x1)
U9_gag(x0)
U7_gg(x0)
U8_gg(x0)

We have to consider all (P,Q,R)-chains.
We use the reduction pair processor [15].


The following pairs can be oriented strictly and are deleted.


GCD_LE_IN_GGA(s(X), Y) → U5_GGA(X, add_in_gag(s(X), Y))
The remaining pairs can at least be oriented weakly.

U1_GGA(X, Y, le_out_gg) → GCD_LE_IN_GGA(X, Y)
U5_GGA(X, add_out_gag(Z)) → GCD_IN_GGA(s(X), Z)
GCD_IN_GGA(X, Y) → U1_GGA(X, Y, le_in_gg(X, Y))
GCD_IN_GGA(X, Y) → U3_GGA(X, Y, gt_in_gg(X, Y))
U3_GGA(X, Y, gt_out_gg) → GCD_LE_IN_GGA(Y, X)
Used ordering: Matrix interpretation [3]:
Non-tuple symbols:
M( le_in_gg(x1, x2) ) =
/0
0/
+
/00
00/
·x1+
/00
00/
·x2

M( U9_gag(x1) ) =
/1
0/
+
/01
01/
·x1

M( 0 ) =
/1
0/

M( s(x1) ) =
/0
1/
+
/00
01/
·x1

M( gt_in_gg(x1, x2) ) =
/0
0/
+
/00
00/
·x1+
/00
00/
·x2

M( add_out_gag(x1) ) =
/1
0/
+
/01
01/
·x1

M( U7_gg(x1) ) =
/0
0/
+
/00
00/
·x1

M( U8_gg(x1) ) =
/0
0/
+
/00
00/
·x1

M( add_in_gag(x1, x2) ) =
/0
0/
+
/10
00/
·x1+
/01
01/
·x2

M( le_out_gg ) =
/0
0/

M( gt_out_gg ) =
/0
0/

Tuple symbols:
M( GCD_IN_GGA(x1, x2) ) = 1+
[0,1]
·x1+
[0,1]
·x2

M( U1_GGA(x1, ..., x3) ) = 1+
[0,1]
·x1+
[0,1]
·x2+
[0,0]
·x3

M( GCD_LE_IN_GGA(x1, x2) ) = 1+
[0,1]
·x1+
[0,1]
·x2

M( U5_GGA(x1, x2) ) = 1+
[0,1]
·x1+
[1,0]
·x2

M( U3_GGA(x1, ..., x3) ) = 1+
[0,1]
·x1+
[0,1]
·x2+
[0,0]
·x3


Matrix type:
We used a basic matrix type which is not further parametrizeable.


As matrix orders are CE-compatible, we used usable rules w.r.t. argument filtering in the order.
The following usable rules [17] were oriented:

add_in_gag(0, X) → add_out_gag(X)
add_in_gag(s(X), s(Z)) → U9_gag(add_in_gag(X, Z))
U9_gag(add_out_gag(Y)) → add_out_gag(Y)



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
                      ↳ QDP
                        ↳ QDPOrderProof
QDP
                            ↳ DependencyGraphProof

Q DP problem:
The TRS P consists of the following rules:

U1_GGA(X, Y, le_out_gg) → GCD_LE_IN_GGA(X, Y)
U5_GGA(X, add_out_gag(Z)) → GCD_IN_GGA(s(X), Z)
GCD_IN_GGA(X, Y) → U1_GGA(X, Y, le_in_gg(X, Y))
U3_GGA(X, Y, gt_out_gg) → GCD_LE_IN_GGA(Y, X)
GCD_IN_GGA(X, Y) → U3_GGA(X, Y, gt_in_gg(X, Y))

The TRS R consists of the following rules:

add_in_gag(s(X), s(Z)) → U9_gag(add_in_gag(X, Z))
gt_in_gg(s(X), s(Y)) → U7_gg(gt_in_gg(X, Y))
gt_in_gg(s(X), 0) → gt_out_gg
le_in_gg(s(X), s(Y)) → U8_gg(le_in_gg(X, Y))
le_in_gg(0, s(Y)) → le_out_gg
le_in_gg(0, 0) → le_out_gg
U9_gag(add_out_gag(Y)) → add_out_gag(Y)
U7_gg(gt_out_gg) → gt_out_gg
U8_gg(le_out_gg) → le_out_gg
add_in_gag(0, X) → add_out_gag(X)

The set Q consists of the following terms:

add_in_gag(x0, x1)
gt_in_gg(x0, x1)
le_in_gg(x0, x1)
U9_gag(x0)
U7_gg(x0)
U8_gg(x0)

We have to consider all (P,Q,R)-chains.
The approximation of the Dependency Graph [15,17,22] contains 0 SCCs with 5 less nodes.